-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Missing the obvious <?php #9358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Simple missing <?php had me wondering for an hour
@nasaralla thanks for your first contribution to this repository. However, this is not really an error but a decision. We decided to not include any PHP opening tag in the docs (here you have more details: #8324 (comment)) Other frameworks do the same in their docs. Now a comment directed at the people who manage this repository: @weaverryan, @xabbuh, @wouterj and @HeahDude. What do you think about adding In 2015 some people asked us to add it (#5741) but we said no. In 2016 some people asked us to add it (#6389) but we said no. In 2017 some people asked us to add it (#8324) but we said no. When lots of people ask you to change your decision ... you probably made a wrong decision. |
The reasons for closing #5741 are still valid IMO. |
I don't think they'll read an external document. The thing is that if you are a newcomer and reading the first tutorial of some project, you probably copy+paste things without much thinking to test them in your browser. That's why I do at least 😅 , so I expect my first copy+paste to work perfectly. |
I also think like @javiereguiluz that the first read is worth special attention and may warrant a different policy |
This may also give a bad habit :), and can be frustrating when the first works and not the others. I have no hard feeling on this, but my point is that we better learn from mistakes than from things working out of the box. Again, I'm fine either way, just expressing another opinion here :). |
Sure, but when you doubt, things are not working and you do exactly as said in the docs and it's not working, it's a desperate situation and if it's only for one But I do think it's only valid for that specific page. |
Well for me I am doing php for 9 / 10 years ... and even I didn't spot that |
+1 for adding it to the intro docs. And maybe to other docs later, but let’s start there. I have always seen people copy code in trainings and try to debug their missing open php tag (which is really tricky). Just last month it happened to maybe 10% if a conference workshop. I think it’s time to be pragmatic. |
Could we add this automatically when PHP code blocks are rendered? |
@xabbuh that's actually a very nice idea. I've put together some quick CSS styles: .highlight-php .highlight pre {
position: relative;
padding-top: 30px;
}
.highlight-php .linenos {
padding-top: 30px;
}
.highlight-php .highlight pre::before{
content: "<?php";
color: #999;
position: absolute;
top: 5px
} And this is how it looks: There's a problem though: content generated via CSS is not selectable 😢 |
Let's merge this "as is" and we'll add more opening tags if needed. @nasaralla thanks for improving the docs for newcomers and congrats on your fitst Symfony Docs contribution. We merged it on 2.7 branch, the oldest maintained branch, and we'll merge it up later. That's why GitHub displays it as closed instead of merged, but it's merged. |
Simple missing <?php had me wondering for an hour